package com.yuyou.tas.lesson.mapper;

import com.yuyou.tas.service.api.admin.entity.AuthUser;
import com.yuyou.tas.service.api.lesson.dto.FeedbackLessonClassDTO;
import com.yuyou.tas.service.api.lesson.dto.LessonClassDTO;
import com.yuyou.tas.service.api.lesson.dto.LessonClassPageDTO;
import com.yuyou.tas.service.api.lesson.entity.LessonClass;
import com.yuyou.tas.service.api.lesson.vo.LessonClassVo;
import com.yuyou.tas.util.bean.Pagination;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface LessonClassMapper {
    int deleteByPrimaryKey(Long id);
    
    int delByOrgan7OId(@Param(value="oId") Long oId,@Param(value="authOrganizationId") Long authOrganizationId);
    
    int insert(LessonClass record);

    LessonClass selectByPrimaryKey(Long id);
    
    LessonClass selectByOrgan7OId(@Param(value="oId") Long oId,@Param(value="authOrganizationId") Long authOrganizationId);

    int updateByPrimaryKeySelective(LessonClass record);

    int findLessonClassPageCount(Pagination<LessonClassPageDTO> p);

    List<LessonClassPageDTO> findLessonClassPageList(Pagination<LessonClassPageDTO> p);

    List<AuthUser> findTeacherOfClass(@Param(value = "classId") Long classId, @Param(value = "type")Integer type);

    LessonClassDTO findLessonClassByClassId(Long classId);
    
    List<LessonClass> findByLessonId(Long lessonId);

    List<LessonClass> findByClassIds(@Param(value = "classIds") List<Long> classIds);

    List<LessonClass> selectBySchoolId(@Param(value="schoolId") Long schoolId , @Param(value="status") Integer status);

    int countLessonClassByLessonIdTrimesterIdStatus(@Param(value="lessonId")Long lessonId, @Param(value="baseTrimesterId")Long baseTrimesterId,  @Param(value="status") Integer status);

    List<LessonClass> selectByTrimester(@Param(value="trimesterId") Long trimesterId);

    int updateInitLessonClassStatus();

    int updateOpeningLessonClassStatus();

    List<String> findOrgUseByLess(@Param(value = "lessonId") Long lessonId);

    List<String> findClassNameByLess(@Param(value = "lessonId") Long lessonId);

    List<LessonClassVo> findLessonClassByOrganId(@Param(value = "organId") Long organId);
    
    /**
     * 找出需要同步的班级学生
     * @return
     */
    List<LessonClass> findNeedSycnClassStudent(@Param(value = "createTime") String createTime);

    List<FeedbackLessonClassDTO> findFeedbackLessonClassByTeacher(@Param(value = "teacherId") Long teacherId,
                                                                  @Param(value = "trimesterId") Long trimesterId);

    List<LessonClassDTO> findLessonClassByTeacher(@Param(value = "teacherId") Long teacherId,
                                                  @Param(value = "schoolId") Long schoolId,
                                                  @Param(value = "trimesterId") Long trimesterId,
                                                  @Param(value = "sectionId") Long sectionId,
                                                  @Param(value = "levelId") Long levelId,
                                                  @Param(value = "fromRecord") Integer fromRecord,
                                                  @Param(value = "toRecord") Integer toRecord);




    Integer findLessonClassCountByTeacher(@Param(value = "teacherId") Long teacherId,
                                                  @Param(value = "schoolId") Long schoolId,
                                                  @Param(value = "trimesterId") Long trimesterId,
                                                  @Param(value = "sectionId") Long sectionId,
                                                  @Param(value = "levelId") Long levelId);

    /**
     * 根据班级ids 和班级状态查找班级
     * @param classIds
     * @param classStatus
     * @return
     */
    List<LessonClass> findByClassIdsAndClassStatus(@Param(value = "classIds")List<Long> classIds, @Param(value = "classStatus")Integer classStatus);
}